package modele;

import static org.junit.Assert.*;

import modele.Personne;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class TestPersonne {

	private Personne personne;

	@Before
	public void setUp() throws Exception {

		personne = new Personne();
	}

	@After
	public void tearDown() throws Exception {

	}

	@Test
	public void testConstructeurAvecParam() {

		String nom = "dupond";
		String prenom = "toto";

		Personne personne = new Personne(nom, prenom);

		String result1 = personne.getNom();
		String result2 = personne.getPrenom();

		assertTrue("expected = " + nom + " | result = " + result1,
				nom.equals(result1));

		assertTrue("expected = " + prenom + " | result = " + result2,
				prenom.equals(result2));

	}

	@Test
	public void testNom() {

		String expected = "Toto";
		personne.setNom(expected);
		String result = personne.getNom();
		assertTrue("expected = " + expected + " | result = " + result,
				expected.equals(result));

		expected = "éeToto";
		personne.setNom(expected);
		result = personne.getNom();
		assertTrue("expected = " + expected + " | result = " + result,
				expected.equals(result));

		expected = "éeTo55to78";
		personne.setNom(expected);
		result = personne.getNom();
		assertTrue("expected = " + expected + " | result = " + result,
				expected.equals(result));
	}

	/*
	 * @Test public void testAge() {
	 * 
	 * int age = 5; personne.setAge(age); int result = personne.getAge();
	 * 
	 * 
	 * 
	 * 
	 * assertTrue("expected = " + age + " | result = " + result , age == result)
	 * ; }
	 * 
	 * @Test public void testAgeNegatif() {
	 * 
	 * int age = -5; personne.setAge(age); int result = personne.getAge();
	 * 
	 * assertTrue("expected = " + age + " | result = " + result , age != result)
	 * ; }
	 */

	@Test
	public void testPasswordMin() {

		String expected = "123456";
		personne.setPassword(expected);
		String result = personne.getPassword();

		assertTrue("expected = " + expected + " | result = " + result,
				(expected.equals(result)));

		String expected1 = "123";
		personne.setPassword(expected1);
		String result1 = personne.getPassword();

		assertTrue("expected = " + expected1 + " | result = " + result1,
				!(expected1.equals(result1)));
	}

	@Test
	public void testemail() {

		String expected = "t@";
		personne.setEmail(expected);
		String result = personne.getEmail();

		assertTrue("expected = " + expected + " | result = " + result,
				expected.equals(result));

		String expected1 = "t";
		personne.setEmail(expected1);
		String result1 = personne.getEmail();

		assertTrue("expected = " + expected1 + " | result = " + result1,
				!(expected1.equals(result1)));
	}
}